<template>
    <div class="content-box">
        <el-upload class="upload-demo" drag v-model:file-list="fileList" ref="uploadRef"
            action="http://127.0.0.1:7777/upload" :on-success="onSuccess" :auto-upload="false">
            <el-icon class="el-icon--upload"><upload-filled /></el-icon>
            <div class="el-upload__text">
                拖拽文件到这或 <em>点击上传</em>
            </div>
            <template #tip>
                <div class="el-upload__tip">
                    jpg/png 文件小于 500kb,上传成功请到软件<el-text class="mx-1" type="success">upload/ico</el-text>目录下获取
                </div>
            </template>
        </el-upload>
        <el-button @click="upload">上传</el-button>
    </div>
</template>
<script setup>
import { UploadFilled } from '@element-plus/icons-vue'
import { ElMessage } from 'element-plus'
import { imgToIcon } from '@/api/wmf.js'
import { ref } from 'vue'
const uploadRef = ref()
const fileList = ref([])
const upload = () => {
    uploadRef.value.submit()
}
const onSuccess = () => {
    ElMessage({
        message: '成功',
        type: 'success',
    })
}
</script>